package com.es.commons.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;


/**
 * 描述:
 * springboot-api接口
 *
 * @author Derek
 * @create 2021-12-03 11:56
 */

@Configuration
@EnableOpenApi
public class Knife4jConfigurer {

    @Bean(value = "defaultApi2")
    public Docket defaultApi2() {
        Docket docket = new Docket(DocumentationType.OAS_30)
                .apiInfo(new ApiInfoBuilder()
                        .title("养老管理系统")
                        .description("养老管理系统接口-APIs")
                        .termsOfServiceUrl("http://www.everysucceed.com/")
                        .contact(new Contact("Derek", "http://www.everysucceed.com", "779066006@qq.com"))
                        .version("1.0")
                        .build())
                //分组名称
                .groupName("3.0版本")
                .select()
                //这里指定Controller扫描包路径
                .apis(RequestHandlerSelectors.basePackage("com.es"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }
}

